package com.example.serviceconsumer.controller;

import com.example.serviceconsumer.feign.ProviderClient;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

/***
 * @author wangpeng
 * @since 2021-06-04  20:00
 */
@RestController
@RequiredArgsConstructor
public class ConsumerController {

    private final ProviderClient providerClient;

    @GetMapping("/hello")
    public Mono<String> hello(){
      return  providerClient.hello().flatMap(hello -> Mono.just(hello + " world"));
    }
}
